export function formatNumberStr(value: number,unit=false) {
  let unitName = "";
  let val = value;
  if (Number(value) >= 10000000) {
    val = keepTwoDecimalStr(Number(value) / 100000000)
    unitName = "亿"
  } else if (Number(value) >= 1000000) {
    val = Number(keepTwoDecimalStr(Number(value) / 10000).toFixed(0))
    unitName = "万"
  }else if (Number(value) >= 1000) {
    val = keepTwoDecimalStr(Number(value) / 10000)
    unitName = "万"
  }
  if(unit){
    return val + unitName;
  }else {
    return val ;
  }
}
const keepTwoDecimalStr = (num: number) => {
  const result = Number(num.toString().match(/^\d+(?:\.\d{0,2})?/));
  let s = result.toString();
  let rs = s.indexOf('.');
  if (rs < 0) {
    rs = s.length;
    s += '.';
  }
  while (s.length <= rs + 2) {
    s += '0';
  }
  return Number(s);
};